import numpy as np
from sklearn import svm
from sklearn.model_selection import train_test_split


X = np.loadtxt("data/X/data.csv", delimiter=",")
y = np.loadtxt("data/target/data.csv", delimiter=",")

random_state_list = list(range(100))

scores = []

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=83)

degree_list = [3,4,6,12,22,10,2]

for degree in degree_list:
    clf = svm.SVC(kernel="poly", degree=degree)
    clf.fit(X_train, y_train)
    score = clf.score(X_test, y_test)
    scores.append(score)

print(max(scores), degree_list[scores.index(max(scores))])
